package com.example.date;

import android.util.Log;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class DateTest {

    public static void main(String[] args) {

        int startY = 2021;
        int startM = new Random().nextInt(12) + 1;
        int startD = new Random().nextInt(20) + 1;


        startM = 7;
        startD = 5;


        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        String dateSel = startY + "-" + startM + "-" + startD;


        Date datecl = null, dateNow = null;
        try {
            dateNow = DateUtils.getThisWeekMonday(new Date());
            datecl = sdf.parse(dateSel);
        } catch (ParseException e) {
            e.printStackTrace();
        }

//        System.out.println("yes " + datecl.getTime() + " " + dateNow.getTime());
//
//        if (DateUtil.getStringByFormat(datecl, "yyyy-MM-dd HH:mm:ss").equals(
//                DateUtil.getStringByFormat(dateNow, "yyyy-MM-dd HH:mm:ss")
//        )) {
//        System.out.println("yes " + datecl.getTime() + " " + dateNow.getTime());
//            System.out.println("equal " + DateUtil.getStringByFormat(datecl, "yyyy-MM-dd HH:mm:ss") + " " + DateUtil.getStringByFormat(dateNow, "yyyy-MM-dd HH:mm:ss"));
//            return;
//        }

        if ((datecl.getTime() / 1000) < (dateNow.getTime() / 1000)) {
            System.out.println("yes " + datecl.getTime() + " " + dateNow.getTime());
            System.out.println("yes " + DateUtil.getStringByFormat(datecl, "yyyy-MM-dd HH:mm:ss") + " " + DateUtil.getStringByFormat(dateNow, "yyyy-MM-dd HH:mm:ss"));
        } else {
            System.out.println("no " + datecl.getTime() + " " + dateNow.getTime());
            System.out.println("no " + DateUtil.getStringByFormat(datecl, "yyyy-MM-dd HH:mm:ss") + " " + DateUtil.getStringByFormat(dateNow, "yyyy-MM-dd HH:mm:ss"));
        }
    }
}
